
package com.tenentia.pcmps.swm.web.listeners;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.apache.log4j.Logger;

import com.tenentia.pcmps.swm.Constants;

/**
 * 
 * @author tEnEntia, S.L.N.E.
 * 
 */
public class ApplicationServletContextListener implements ServletContextListener {

	private static Logger LOGGER;

	public ApplicationServletContextListener() {

		super();
	}

	@Override
	public void contextDestroyed(ServletContextEvent servletContextEvent) {

		LOGGER.info(Constants.STRING_L4J_METHOD_BEGIN);

	}

	@Override
	public void contextInitialized(ServletContextEvent servletContextEvent) {

		LOGGER = Logger.getLogger(ApplicationServletContextListener.class.getPackage().getName());

		LOGGER.info(Constants.STRING_L4J_METHOD_BEGIN);

//		try {
//			
//			MarketingPromotionsManager businessLogicObject = (MarketingPromotionsManager) BusinessLogicObjectsFactory.getInstance().createNewBusinessObject(BusinessLogicObjectsFactory.MARKETING_PROMOTIONS_MANAGER);
//			Date currentDate = new Date();
//			List<InsurancePolicyMarketingPromotion> tmpList = businessLogicObject.getAvailableMarketingPromotions(currentDate);
//			for (Iterator<InsurancePolicyMarketingPromotion> iterator = tmpList.iterator(); iterator.hasNext();) {
//				InsurancePolicyMarketingPromotion insurancePolicyMarketingPromotion = iterator.next();
//				LOGGER.debug(insurancePolicyMarketingPromotion);
//			}
//		} catch (Exception e) {
//			LOGGER.error(e, e);
//		}
	}
}
